package high.concurrent.component;

import high.concurrent.strategy.CreateCodePrefixDbConfig;
import high.concurrent.strategy.CreateCodeSuffixTableConfig;
import high.concurrent.utils.CommonUtil;
import org.springframework.stereotype.Component;

@Component
public class OutTradeNoComponent {

    /**
     * 生成订单号
     * @return
     */
    public String createOutTradeNo(){

        String randomCode = CommonUtil.getRandomCode(32);
        // 拼装库前缀 与 表后缀
        String shortLinkCode = CreateCodePrefixDbConfig.getShortLinkDbPrefix() + "_" + randomCode + "_" + CreateCodeSuffixTableConfig.getShortLinkTableSuffix();
        return shortLinkCode;
    }

}
